# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Daniel Micay <danielmicay@gmail.com>
# Contributor: mickael9 <mickael9 at gmail dot com>

pkgname=ncrack
pkgver=0.7
pkgrel=3
pkgdesc='High-speed network authentication cracking tool'
url='https://nmap.org/ncrack/'
arch=('loong64' 'x86_64')
license=('GPL2')
depends=('openssl')
source=(https://github.com/nmap/ncrack/archive/refs/tags/${pkgver}/${pkgname}-${pkgver}.tar.gz
        ncrack-nullcheck.patch)
sha256sums=('f3f971cd677c4a0c0668cb369002c581d305050b3b0411e18dd3cb9cc270d14a'
            'db38a84172ce548614c7e6f2f9f751b31e68716fe3ff68761c21f7e11d6143fc')
sha512sums=('52b327b0330b2e46d71a9442fbacf8471462e093049b68b8f2fab008b7046762c82d0468d004cc042a1342082f5c6b5d20a792f028929a7f039bd8d5e2bd49e0'
            'c5648363def2dd8c8f01e5b039824357383b465373f59912abcfcb150873e6702a848c15ce1eea802c64d8e0fd0d3e88ddac190a1b659cd1b23da020f36b1b0b')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -Np1 -i ../ncrack-nullcheck.patch
}

build() {
  cd ${pkgname}-${pkgver}
  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
  ./configure \
    --prefix=/usr \
    --without-openssl-header-check
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make install DESTDIR="${pkgdir}"
  install -Dm 644 README.md CHANGELOG -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
